﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Workflow.Common.Dao;
using Workflow.IDAO;
using Workflow.Model;
using NHibernate.Linq;

namespace Workflow.DAO
{
	public class FolerClassDao : RepositoryBase<FolerClass>, IFolerClassDao
	{
		public FolerClass GetFolerClassByName(string name)
		{
			var result = Session.Query<FolerClass>();

			result = result.Where(x => x.FolderNameEN == name);

			return result.FirstOrDefault();
		}
		public FolerClass GetFolerClassByCode(string code)
		{
			var result = Session.Query<FolerClass>();

			result = result.Where(x => x.FolderCode == code);

			return result.FirstOrDefault();
		}

		public FolerClass GetFolerClassByName(string name,string caseType)
		{
			var result = Session.Query<FolerClass>();

			result = result.Where(x => x.FolderNameEN == name);
			result = result.Where(x => x.CaseType == caseType);

			return result.FirstOrDefault();
		}
	}
}
